nextflow plugins -help: show subcommands#7197
Conversation
Signed-off-by: Phil Ewels <phil.ewels@seqera.io>
✅ Deploy Preview for nextflow-docs-staging canceled.
|
| void run() { | ||
| if( !args ) | ||
| throw new AbortOperationException("Missing plugin command - usage: nextflow plugin install <pluginId,..>") | ||
| if( !args ) { |
There was a problem hiding this comment.
I think we should print the reason of the failure before printing the usage
| result << '' | ||
| break | ||
| default: | ||
| throw new AbortOperationException("Unknown plugin sub-command: ${args[0]}") |
There was a problem hiding this comment.
The default branch aborts on the <plugin-name>:<command> form, which is the third invocation advertised in the top-level help just above (and arguably the primary purpose of nextflow plugin).
For example nextflow plugin nf-hello:greet -help parses args = ['nf-hello:greet'], command.help is set, so Launcher.checkForHelp() calls usage() → usage(args). args[0] is neither install nor create, so this default throws Unknown plugin sub-command: nf-hello:greet — i.e. asking for help on a documented, valid invocation produces an error claiming it does not exist. (Execution in run() is fine — it handles the : form via args[0].contains(CMD_SEP); only the usage path aborts.)
Suggest falling back to general usage for the : form rather than aborting:
default:
if( args[0].contains(CMD_SEP) ) {
result << 'Execute a plugin-specific command'
result << 'Usage: nextflow plugin <plugin-name>:<command> [args]'
result << ''
result << 'See the documentation of the individual plugin for its available commands.'
result << ''
}
else {
throw new AbortOperationException("Unknown plugin sub-command: ${args[0]}")
}This keeps the genuine typo error (e.g. nextflow plugin instal -help) while not blowing up on the legitimate plugin-command form. Worth a test pinning the behavior down.
Address review feedback on the plugin usage help: - The usage() default branch aborted on the <plugin-name>:<command> form, so `nextflow plugin nf-hello:greet -help` errored claiming the command was unknown. It now falls back to a plugin-specific usage block for the colon form (pditommaso). - For a genuine unknown sub-command, print the failure reason before the general usage rather than a bare abort (jorgee). - Add CmdPluginUsageTest pinning the usage output for each case. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Phil Ewels <phil.ewels@seqera.io>
|
Addressed the review feedback in 81db3ae:
|
Show the available subcommands for
nextflow pluginsin the CLI help.